<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{:session('cp.cpsysname')}--系统管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="{:config('webconfig.description');}">
    <meta name="keywords" content="{:config('webconfig.keywords');}">
    <meta name="author" content="runoob">

    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/wangEditor.css"/>
    <script src="__STATIC_URL__/static/js/jquery-2.1.4.min.js"></script>
    <script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <style>
        .filePicker{
            margin-top: -5px;
            width: 150px;
            height: 44px;
            background: #00A2D4;
            color: #fff;
            text-align: center;
            line-height: 44px;
            border-radius: 4px;
            cursor: pointer;
        }
        .file{
            position: absolute;
            left: 14px;
            top: -5px;
            width: 150px;
            height: 44px;
            line-height: 44px;
            opacity: 0;
            cursor: pointer;
        }
        .img-file{
            width: 100px;
            height: 100px;
            display: block;
            margin-left: 26px;
            margin-top: 10px;
            display: none;
        }
        .form-control{
            width: 50%;
        }
        .error{
            color: #989898;
        }
    </style>
</head>
<body>
{include file='public/header'/}
<!------------------导航-------------------------->
<section id="content">
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgr15 mgl15">
            <ol class="breadcrumb">
                <li>当前位置是:</li>
                <li>
                    <a href="">系统管理</a>
                </li>
                <li class="active" style="color: #02b87f;">版本更新</li>
            </ol>
        </div>
        <div class="panel mgr15 mgl15">
            <div class="form-horizontal adminex-form" >
                <div class="panel-heading addCharts" style="background:#ededed;">
                    版本更新内容

                </div>
                <div class="panel-body">
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">标题：</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name='keyword' value="{$info.keyword}" placeholder=""id="keyword">
                            <input type="hidden" class="form-control" name='id' value="{$info.id}" placeholder="" id="yid">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">状态：</label>
                        <div class="col-sm-10">
                            <select name="type" class="form-control" id="type">
                                <option {if condition="$info['type'] eq 0 "}selected {/if} value="0">微信报错</option>
                                <option {if condition="$info['type'] eq 1 "}selected{/if} value="1">会员卡报错</option>
                                <option {if condition="$info['type'] eq 2 "}selected{/if} value="2">api报错</option>
                                <option {if condition="$info['type'] eq 3 "}selected{/if} value="3">小程序报错</option>
                            </select>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">帮助内容：</label>
                        <div class="col-sm-10"id="show_box">
                            {$info.info}
                        </div>
                        <textarea id="text1" name="content" style="visibility:hidden;"></textarea>
                    </div>

                </div>
                <div class="panel-footer">
                    <button type="button" class="btn btn-primary" onclick="submit();">保存</button>
                </div>
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>
</body>
<script src="__STATIC_URL__/static/js/wangEditor.js"></script>
<!--一级和二级类目选择-->
<script type="text/javascript">

    var E = window.wangEditor;
    var editor = new E('#show_box');
    var $text1 = $('#text1');
    editor.customConfig.onchange = function (html) {
        // 监控变化，同步更新到 textarea
        $text1.val(html)
    };
    editor.create();
    // 初始化 textarea 的值
    $text1.val(editor.txt.html())


</script>
<script>
    function submit(){
        var keyword=$("#keyword").val();
        var type=$("#type").val();
        var data=$("#show_box").find(".w-e-text").html();
        var id=$("#yid").val();

        $.ajax({
            url:"{:url('system/helpedit')}",
            type:"post",
            dataType:"json",
            data:{
                keyword:keyword,
                type:type,
                id:id,
                info:data
            },
            success:function(data){
                console.log(data);
                alert(data.msg);
                window.location.href = "{:url('system/helplog')}";
            }
        })
    }
</script>

</html>

